package come.myStudy;

public class Line {
	private Pont2D startPoint;  //自定义一个点，这个点是class类型，class默认值是null
	private Pont2D endPoint;
	public Line() {
		startPoint = endPoint = new Pont2D();
	}
	public Line(Pont2D startPoint,Pont2D endPoint) {
		this.startPoint = startPoint;
		this.endPoint = endPoint;
	}
	public Line(int x1,int y1,int x2,int y2) {
		
		this.startPoint = new Pont2D(x1,y1);
		this.endPoint = new Pont2D(x2,y2);
	}
	public String toString() {
		return String.format("从%s到%s的直线", this.startPoint,this.endPoint);
	}
	
	public double ComputeDistance() {
		return Util.distanceBetweenTwoPoints(this.startPoint, this.endPoint);
	}
}
